package com.lx.base.util;

import java.security.SecureRandom;

/**
 * @author lixing
 * @date 2022/8/9 14:49
 */
public class RandomUtil {
    /**
     * 产生随机数
     * @param nums 随机数长度
     * @return
     */
    public static  String getRandom(int nums){
        StringBuffer sb=new StringBuffer();
        SecureRandom random=null;
        while(true){
         random=new SecureRandom();
         random.setSeed(1000L);
            sb.append(random.nextLong()) ;
            if(sb.length()>=nums) {
                break;
            }
            }

        return    sb.toString().substring(0,nums);
    }


}
